<template>
  <div class="search">
    <f-form ref="form" :action="api.bbw" :form-key="this.formItem.WBSID">
      <f-form-item label="" name="projectCode" :value="formItem.projectCode"/>
      <f-form-item label="" name="projectName" :value="formItem.projectName"/>
      <f-form-item label="" name="GRADATION" :value="formItem.GRADATION"/>
      <f-form-item label="" name="WBSCODE" :value="formItem.WBSCODE"/>
      <f-form-item label="" name="WBSDESCRIBE" :value="formItem.WBSDESCRIBE"/>
      <f-form-item label="" name="BUDGETAMOUNT" :value="formItem.BUDGETAMOUNT"/>
      <f-form-item label="" name="ACTUALAMOUNT" :value="formItem.ACTUALAMOUNT"/>
      <f-form-item label="" name="PROMISEAMOUNT" :value="formItem.PROMISEAMOUNT"/>
      <f-form-item label="" name="ISDEL" :value="formItem.ISDEL"/>
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'

  export default {
    name: 'bbwForm',
    props: {},
    data() {
      return {
        refs: this.$refs,
        api: Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          WBSID: '',
          projectCode: '',
          projectName: '',
          GRADATION: '',
          WBSCODE: '',
          WBSDESCRIBE: '',
          BUDGETAMOUNT: '',
          ACTUALAMOUNT: '',
          PROMISEAMOUNT: '',
          ISDEL: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.WBSID) {
          let params = {
            WBSID: data.WBSID
          }
          this.refs['form'].getDetails(params, (data) => {
            this.formItem = data
            this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({}, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
